package com.baizhi.buff2;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 字节缓冲流的缓冲区问题
 */
public class BufferedOutputSteamDemo {

    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("./javase_io/a.text");
        BufferedOutputStream bos = new BufferedOutputStream(fos); //缓冲字节流

        bos.write("我撑着油纸伞，彷徨在悠长悠长又寂寥的雨巷".getBytes());

        /*
            void flush() 强制冲刷缓冲区
         */
      //  bos.flush(); //冲刷缓冲区

        System.out.println("写出完毕");

        bos.close(); // 自动冲刷缓冲区
    }
}
